/*
day247
2020.5.1
*/
#include<cstdlib>
using namespace std;

struct TreeNode {
   int val;
   TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
public:
    bool checkSubTree(TreeNode* t1, TreeNode* t2) {
    	if(!t1 && !t2)
    	{
    		return true;
		}
		
		if(!t1)
		{
			return false;
		}
		
		if(!t2)
		{
			return true;
		}
    	
		if(t1->val == t2->val)
		{
			if(isequal(t1,t2))
			{
				return true;
			}
		}
		
		return checkSubTree(t1->left,t2) || checkSubTree(t1->right,t2);
    }
    
    
    bool isequal(TreeNode *t1,TreeNode *t2)
    {
    	if(!t1 && !t2)
    	{
    		return true;
		}
		
		if(!t1 || !t2)
		{
			return false;
		}
		
		if(t1->val != t2->val)
		{
			return false;
		}
		
		return isequal(t1->left,t2->left) && isequal(t1->right,t2->right);
	}
};

int main()
{
	return 0;
}
